package jhub.text;

import java.text.MessageFormat;
import java.text.ParseException;

import jhub.DCProtocol;

public class PassiveSearchResultMessage extends DCRawCommand{
    
    private String replyNick;
    private String searchString;
    private String searchNick;
    
    public DCRawCommand getReplyCommand(){
        return new DCRawCommand(MessageFormat.format(DCProtocol.PASSIVE_SEARCH_RESULT_REPLY_FORMAT,replyNick,searchString));
    }
    
    
    public PassiveSearchResultMessage(String command) throws ParseException {
        super(command);
        parse();
    }
    
    private void parse() throws ParseException{
        Object[] o = new MessageFormat(DCProtocol.PASSIVE_SEARCH_RESULT_FORMAT).parse(command.toString());
        replyNick = o[0].toString();
        searchString = o[1].toString();
        searchNick = o[1].toString();
    }

    public String getReplyNick() {
        return replyNick;
    }

    public void setReplyNick(String replyNick) {
        this.replyNick = replyNick;
    }

    public String getSearchString() {
        return searchString;
    }

    public void setSearchString(String searchString) {
        this.searchString = searchString;
    }

    public String getSearchNick() {
        return searchNick;
    }

    public void setSearchNick(String searchNick) {
        this.searchNick = searchNick;
    }

}
